package com.chenju.javastatic.component.config;

import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.Driver;
import org.neo4j.driver.GraphDatabase;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Neo4JConfig {
    @Value("${spring.neo4j.uri}")
    private String neo4jUrl;
    @Value("${spring.neo4j.authentication.username}")
    private String neo4jUser;
    @Value("${spring.neo4j.authentication.password}")
    private String neo4jPassword;

    @Bean
    public Driver driver() {
        return GraphDatabase.driver(neo4jUrl, AuthTokens.basic(neo4jUser, neo4jPassword));
//        return GraphDatabase.driver("bolt://192.168.16.129:7687", AuthTokens.basic("neo4j", "123456"));
    }
}
